package com.lanou.shunke.admin.service;


import com.github.pagehelper.PageHelper;
import com.lanou.shunke.admin.entity.User;
import com.lanou.shunke.admin.mapper.UserMapper;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {

    @Autowired
    private UserMapper mapper;

    public Boolean login(User user) {
        Integer admin = mapper.login(user);
        if (admin == 0) {
            return false;
        }
        return true;
    }

    public List<User> selectAllUser(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        return mapper.selectAllUser();
    }

    public List<User> selectBanUser(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        return mapper.selectBanUser();

    }

    /*public List<User> selectReportUser(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<User> list = mapper.selectReportUser();
        return list;
    }*/

    public void rmUserByUid(int uid) {
        mapper.rmUserByUid(uid);
    }

    public void unSealing(int uid) {
        mapper.unSealing(uid);
    }

    public List<User> searchUser(String uname) {
        return mapper.searchUserByUname(uname);
    }
}
